// Copyright (c) Microsoft Corporation.  All rights reserved.

#pragma once

using namespace System;
using namespace System::Text;
using namespace System::Security::Principal;

namespace Microsoft { namespace Samples { namespace SqlServer { namespace SSIS { namespace EventLogSource
{

	public enum class EventType {
		Error = EVENTLOG_ERROR_TYPE,
		Failure = EVENTLOG_AUDIT_FAILURE,
		Success = EVENTLOG_AUDIT_SUCCESS,
		Information = EVENTLOG_INFORMATION_TYPE,
		Warning = EVENTLOG_WARNING_TYPE
	};

	// TODO make internal
	public ref class EventRecord
	{
	private:
		PEVENTLOGRECORD logRecord;
		PBYTE buffer;
		SecurityIdentifier^ sid;
		String^ source;
		String^ computerName;
		array<String^>^ messageStrings;
		array<Byte>^ data;

	public:
		EventRecord();
		void Initialize(PEVENTLOGRECORD);

		property UInt16 Category { UInt16 get(); }
		property UInt32 Id { UInt32 get(); }
		property UInt16 MessageId { UInt16 get(); }
		property EventType Type { EventType get(); }
		property array<Byte>^ Data { array<Byte>^ get(); }
		property UInt16 NumStrings { UInt16 get(); }
		property UInt32 RecordNumber { UInt32 get(); }
		property DateTime TimeGeneratedUTC { DateTime get(); }
		property DateTime TimeWrittenUTC { DateTime get(); }
		property SecurityIdentifier^ Sid { SecurityIdentifier^ get(); }
		property array<String^>^ MessageStrings { array<String^>^ get(); }
		property String^ ComputerName { String^ get(); }
		property String^ Source { String^ get(); }
		virtual String^ ToString() override;
	};
} } } } }
